<!DOCTYPE html>
<html lang='cn' xmlns:th="http://www.thymeleaf.org" xmlns:display="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8"/>
    <title>添加商品</title>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport"/>
    <meta content="" name="description"/>
    <meta content="" name="author"/>
    <link th:href="@{/backend/css/bootstrap.min.css}" href="../../../static/backend/css/bootstrap.min.css"
          rel="stylesheet" type="text/css"/>
    <link th:href="@{/backend/css/bootstrap-responsive.min.css}"
          href="../../../static/backend/css/bootstrap-responsive.min.css" rel="stylesheet" type="text/css"/>
    <link th:href="@{/backend/css/font-awesome.min.css}" href="../../../static/backend/css/font-awesome.min.css"
          rel="stylesheet" type="text/css"/>
    <link th:href="@{/backend/css/style-metro.css}" href="../../../static/backend/css/style-metro.css" rel="stylesheet"
          type="text/css"/>
    <link th:href="@{/backend/css/style.css}" href="../../../static/backend/css/style.css" rel="stylesheet"
          type="text/css"/>
    <link th:href="@{/backend/css/style-responsive.css}" href="../../../static/backend/css/style-responsive.css"
          rel="stylesheet" type="text/css"/>
    <link th:href="@{/backend/css/default.css}" href="../../../static/backend/css/default.css" rel="stylesheet"
          type="text/css" id="style_color"/>
    <link th:href="@{/backend/css/uniform.default.css}" href="../../../static/backend/css/uniform.default.css"
          rel="stylesheet" type="text/css"/>
    <link th:href="@{/backend/css/pagination.css}" href="../../../static/backend/css/pagination.css" rel="stylesheet"
          type="text/css"/>
    <link rel="stylesheet" type="text/css" th:href="@{/backend/css/bootstrap-fileupload.css}"
          href="../../../static/backend/css/bootstrap-fileupload.css"/>
    <link rel="shortcut icon" th:href="@{/backend/images/favicon.ico}"
          href="../../../static/backend/images/favicon.ico"/>
    <link rel="stylesheet" href="../../../static/fileupload/control/css/zyUpload.css"
          th:href="@{/fileupload/control/css/zyUpload.css}" type="text/css">


</head>

<body>

<div class="container-fluid">


    <div class="row-fluid">
        <h3 class="page-title"><i class="fa fa-shopping-bag"></i> 商品管理</h3>
        <ul class="breadcrumb">
            <li>
                <a href="list.html"><i class="fa fa-home"></i>商品管理</a>
                <i class="fa fa-angle-right"></i>
            </li>
            <li>
                <a href="#">添加商品</a>
            </li>
        </ul>
    </div>
    <div class="row-fluid">
        <div class="portlet box light-blue">
            <div class="portlet-title">
                <div class="caption">
                    <i class="fa fa-reorder"></i>
                    添加商品
                </div>
            </div>
            <div class="portlet-body">
                <form class="form-horizontal" enctype="multipart/form-data" method="post"
                      action="/fleastreet/manager/product/add">
                    <div class="control-group">
                        <label class="control-label">商品名称：</label>
                        <div class="controls">
                            <input name="name" type="text" class="m-wrap large"/>
                            <!--<span class="help-inline">name</span>-->
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">数量:</label>
                        <div class="controls">
                            <input name="number" type="text" class="m-wrap large"/>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">价格：</label>
                        <div class="controls">
                            <div class="input-prepend">
                                <span class="add-on">￥</span>
                                <input name="price" type="text" class="m-wrap small"/>
                            </div>
                            <!--<span class="help-inline">price</span>-->
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">所属产品子类：</label>
                        <div class="controls">
                            <select name="typeId" class="small m-wrap">
                            </select>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">上下架：</label>
                        <div class="controls">
                            <select name="state" class="small m-wrap small">
                                <option selected="selected" value="1000">上架</option>
                                <option value="1100">下架</option>
                            </select>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">商品图片：</label>
                        <div class="controls">
                            <div class="fileupload fileupload-new" data-provides="fileupload">
                                <div class="fileupload-new thumbnail" style="width: 200px; height: 150px;">
                                    <!--<img th:src="${product.image }" alt=""/>-->
                                </div>
                                <div class="fileupload-preview fileupload-exists thumbnail"
                                     style="max-width: 200px; max-height: 150px; line-height: 20px;"></div>
                                <div>
											<span class="btn btn-file">
												<span class="fileupload-new">选择图片</span>
												<span class="fileupload-exists">换一张</span>
												<input name="fileselect" type="file" class="image"/>
											</span>
                                    <a href="#" class="btn fileupload-exists" data-dismiss="fileupload">移除</a>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="control-group" style="margin-top: 40px;position:relative;">
                        <label class="control-label">商品描述：</label>
                        <div class="controls">
                            <textarea name="productContent" class="m-wrap large" rows="4"></textarea>
                        </div>
                    </div>
                    <div class="control-group" style="margin-top: 40px;position:relative;">
                        <label class="control-label">商品标签：</label>
                        <div class="controls">
                            <textarea name="tagContent" class="m-wrap large" rows="4" placeholder="请以分号分割"></textarea>
                        </div>
                    </div>

                    <div class="form-actions" style="margin-top: auto;position:relative;">
                        <button type="submit" class="btn blue"><i class="fa fa-check"></i>确定</button>&emsp;
                        <button type="button"
                                onclick="javascript:window.location.href='/fleastreet/manager/product/list';"
                                class="btn"><i
                                class="fa fa-times"></i>返回
                        </button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>


<script th:src="@{/backend/js/jquery-1.10.1.min.js}" src="../../../static/backend/js/jquery-1.10.1.min.js"
        type="text/javascript"></script>
<script src="../../../static/frontend/layer/layer.js" th:src="@{/frontend/layer/layer.js}"></script>
<script th:src="@{/backend/js/jquery-migrate-1.2.1.min.js}" src="../../../static/backend/js/jquery-migrate-1.2.1.min.js"
        type="text/javascript"></script>
<!-- IMPORTANT! Load jquery-ui-1.10.1.custom.min.js before bootstrap.min.js to fix bootstrap tooltip conflict with jquery ui tooltip -->
<script th:src="@{/backend/js/jquery-ui-1.10.1.custom.min.js}"
        src="../../../static/backend/js/jquery-ui-1.10.1.custom.min.js" type="text/javascript"></script>
<script th:src="@{/backend/js/bootstrap.min.js}" src="../../../static/backend/js/bootstrap.min.js"
        type="text/javascript"></script>
<script th:src="@{/backend/js/jquery.slimscroll.min.js}" src="../../../static/backend/js/jquery.slimscroll.min.js"
        type="text/javascript"></script>
<script th:src="@{/backend/js/jquery.blockui.min.js}" src="../../../static/backend/js/jquery.blockui.min.js"
        type="text/javascript"></script>
<script th:src="@{/backend/js/jquery.cookie.min.js}" src="../../../static/backend/js/jquery.cookie.min.js"
        type="text/javascript"></script>
<script th:src="@{/backend/js/jquery.uniform.min.js}" src="../../../static/backend/js/jquery.uniform.min.js"
        type="text/javascript"></script>
<script type="text/javascript" th:src="@{/backend/js/bootstrap-fileupload.js}"
        src="../../../static/backend/js/bootstrap-fileupload.js"></script>
<script th:src="@{/backend/js/jquery.pagination.js}" src="../../../static/backend/js/jquery.pagination.js"
        type="text/javascript"></script>
<script th:src="@{/backend/js/app.js}" src="../../../static/backend/js/app.js" type="text/javascript"></script>
<!-- 引用核心层插件 -->
<script src="../../../static/fileupload/core/zyFile.js" th:src="@{/fileupload/core/zyFile.js}"></script>
<!-- 引用控制层插件 -->
<script src="../../../static/fileupload/control/js/zyUpload.js" th:src="@{/fileupload/control/js/zyUpload.js}"></script>
<!-- 引用初始化JS -->
<script src="../../../static/fileupload/core/jq22.js" th:src="@{/fileupload/core/jq22.js}"></script>
<script>
    //	<![CDATA[
    $(function () {
        App.init();


        //加载分类列表
        $.ajax({
            url: "/fleastreet/manager/category/type/list",
            type: "post",
            success: function (result) {
                if (result.code == 0) {
                    showData(result.data);
                } else {
                    layer.msg(result.msg);
                }
            }
        });

    });

    function showData(data) {
        var select = $("[name='typeId']");
        if (!data || !data.length > 0) {
            return;
        }
        for (var i = 0; i < data.length; i++) {
            var option = $("<option></option>");
            option.attr("value", data[i].productTypeId);
            option.text(data[i].typeName);
            select.append(option);
        }
    }


  /*  $("#add-image").bind("click", function () {
        //在结构中加入一个添加图片的地方，并且给其增加添加图片的按钮
        var another = $("#none").css('display', 'block').removeAttr('id');
        $(".controls").eq(5).append(another)
        $("#add-image").css('display', 'none').removeAttr("id");
        $(".onlyOne:last").attr('id', "add-image");
    });
    //先移除当前结构中的id,并且让按钮不显示*/

</script>
</body>
</html>